package com.bml.www.teacher.teacher;

import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.bml.www.teacher.R;
import com.pachong.android.baseuicomponent.activity.BaseActivity;

import butterknife.Bind;
import butterknife.OnClick;

public class TeacherStyleActivity extends BaseActivity {

    @Bind(R.id.iv_title)
    ImageView mIvTitle;
    @Bind(R.id.iv_prize)
    ImageView mIvPrize;
    @Bind(R.id.hide_title)
    RelativeLayout mHideTitle;
    @Bind(R.id.hide_prize)
    RelativeLayout mHidePrize;
    private boolean isHide = false;
    private boolean isPrizeHide = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initToolBar();
    }

    private void initToolBar() {
        getCustomToolbar().setBackgroundColor(Color.parseColor("#f3d120"));
        getCustomToolbar().setTitle("教师风采");
        //设置左边返回键
        getCustomToolbar().addLeftImageButton(getResources().getDrawable(R.mipmap.backby), new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.activity_teacher_style, null);
    }

    @OnClick({R.id.rl_title, R.id.rl_prize})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_title:
                if (!isHide) {
                    mIvTitle.setImageDrawable(getResources().getDrawable(R.mipmap.topby));
                    mHideTitle.setVisibility(View.VISIBLE);
                    isHide = true;
                } else {
                    mIvTitle.setImageDrawable(getResources().getDrawable(R.mipmap.bottomby));
                    isHide = false;
                    mHideTitle.setVisibility(View.GONE);
                }

                break;
            case R.id.rl_prize:
                if (!isPrizeHide) {
                    mIvPrize.setImageDrawable(getResources().getDrawable(R.mipmap.topby));
                    isPrizeHide = true;
                    mHidePrize.setVisibility(View.VISIBLE);
                } else {
                    mIvPrize.setImageDrawable(getResources().getDrawable(R.mipmap.bottomby));
                    isPrizeHide = false;
                    mHidePrize.setVisibility(View.GONE);
                }
                break;
        }
    }
}
